package pl.koziolekweb.szkola.EUSimpleMap;

// EU-SimpleMap/ASimpleMap.java
 
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;

public class ASimpleMap {
    public static void main(String[] args) {
        Map<String,String> map =
                // new TreeMap<String,String>();
                new TreeMap<String,String>();

        map.put("Sue","+48 022 986 21 99");
        map.put("Ann","+48 022 985 22 98");
        map.put("Lea","+48 022 984 23 97");
        map.put("Kim","+48 022 983 24 96");

        Iterator<String> iter = map.keySet().iterator();
        while (iter.hasNext()) {
            String key = iter.next();
            String val = map.get(key);
            System.out.println(key + ": " + val);
        }

        System.out.println();

        if (map.containsKey("Ann")) map.remove("Ann");

        for (String s : map.keySet())
            System.out.println(s + ": " + map.get(s));

        System.out.println();

        for (Map.Entry<String,String> e : map.entrySet())
            System.out.println(e.getKey() + ": " +
                               e.getValue());
    }
}
